#ifndef _B1B56541_75B4_4B06_BAA0_F2DCF8EB5A39
#define _B1B56541_75B4_4B06_BAA0_F2DCF8EB5A39

// 此文件为了将c库代码包装为c++库，由此解决和其他项目的类型冲突问题

namespace sqlite3xx
{
    struct sqlite3db;
    struct sqlite3xx_backup;
    static const int SQLITE_OK = 0;   /* Successful result */

    int sqlite3xx_open(
        const char* filename,   /* Database filename (UTF-8) */
        sqlite3db** ppDb          /* OUT: SQLite db handle */
    );
    int sqlite3xx_open16(
        const void* filename,   /* Database filename (UTF-16) */
        sqlite3db** ppDb          /* OUT: SQLite db handle */
    );
    int sqlite3xx_open_v2(
        const char* filename,   /* Database filename (UTF-8) */
        sqlite3db** ppDb,         /* OUT: SQLite db handle */
        int flags,              /* Flags */
        const char* zVfs        /* Name of VFS module to use */
    );

    /*
    ** Specify the key for an encrypted database.  This routine should be
    ** called right after sqlite3_open().
    **
    ** The code to implement this API is not available in the public release
    ** of SQLite.
    */
    int sqlite3xx_key(
        sqlite3db* db,                   /* Database to be rekeyed */
        const void* pKey, int nKey     /* The key */
    );
    int sqlite3xx_key_v2(
        sqlite3db* db,                   /* Database to be rekeyed */
        const char* zDbName,           /* Name of the database */
        const void* pKey, int nKey     /* The key */
    );

    /*
    ** Change the key on an open database.  If the current database is not
    ** encrypted, this routine will encrypt it.  If pNew==0 or nNew==0, the
    ** database is decrypted.
    **
    ** The code to implement this API is not available in the public release
    ** of SQLite.
    */
    int sqlite3xx_rekey(
        sqlite3db* db,                   /* Database to be rekeyed */
        const void* pKey, int nKey     /* The new key */
    );
    int sqlite3xx_rekey_v2(
        sqlite3db* db,                   /* Database to be rekeyed */
        const char* zDbName,           /* Name of the database */
        const void* pKey, int nKey     /* The new key */
    );

    int sqlite3xx_close(sqlite3db* pDb);
    int sqlite3xx_close_v2(sqlite3db* pDb);

    int sqlite3xx_exec(
        sqlite3db* pDb,                                  /* An open database */
        const char* sql,                           /* SQL to be evaluated */
        int (*callback)(void*, int, char**, char**),  /* Callback function */
        void* p,                                    /* 1st argument to callback */
        char** errmsg                              /* Error msg written here */
    );

    void sqlite3xx_free(void* p);

    int sqlite3xx_get_table(
        sqlite3db* db,          /* An open database */
        const char* zSql,     /* SQL to be evaluated */
        char*** pazResult,    /* Results of the query */
        int* pnRow,           /* Number of result rows written here */
        int* pnColumn,        /* Number of result columns written here */
        char** pzErrmsg       /* Error msg written here */
    );

    void sqlite3xx_free_table(char** result);

    sqlite3xx_backup* sqlite3xx_backup_init(
        sqlite3db* pDest,                        /* Destination database handle */
        const char* zDestName,                 /* Destination database name */
        sqlite3db* pSource,                      /* Source database handle */
        const char* zSourceName                /* Source database name */
    );
    int sqlite3xx_backup_step(sqlite3xx_backup* p, int nPage);
    int sqlite3xx_backup_finish(sqlite3xx_backup* p);

    int sqlite3xx_errcode(sqlite3db* db);

    //sqlite3_key 此函数属于sqlcipher
}

#endif
